package com.bdqn.serice.impl;

import com.bdqn.mapper.SmbmsUserMapper;
import com.bdqn.pojo.SmbmsUser;
import com.bdqn.serice.SmbmsUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
class SmbmsUserServiceImpl implements SmbmsUserService {

    @Resource
    private SmbmsUserMapper smbmsUserMapper;


    @Override
    public int deleteUserById(Long id) {
        return smbmsUserMapper.deleteUserById(id);
    }

    @Override
    public int insertOrUpdateSelective(SmbmsUser record) {
        return smbmsUserMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(SmbmsUser record) {
        return smbmsUserMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public SmbmsUser getUserById(String id) {
        return smbmsUserMapper.getUserById(id);
    }

    @Override
    public List<SmbmsUser> getUserList(String queryname, int queryRole, int pageIndex, int pageSize) {
        int pageInde=(pageIndex-1)*pageSize;
        return smbmsUserMapper.getUserList(queryname,queryRole,pageInde,pageSize);
    }

    @Override
    public SmbmsUser selectUserCodeExist(String userCode) {
        return smbmsUserMapper.getLoginUser(userCode);
    }

    @Override
    public SmbmsUser login(String userCode, String userPassword) throws Exception {
        return smbmsUserMapper.getLoginUser(userCode);
    }

    @Override
    public int getUserCount(String userName, int userRole) {
        return smbmsUserMapper.getUserCount(userName,userRole);
    }

    @Override
    public int updatePwd(Long id, String pwd) {
        return smbmsUserMapper.updatePwd(id,pwd);
    }
}
